# Copyright 2023 Flant JSC
# Licensed under the Deckhouse Platform Enterprise Edition (EE) license. See https://github.com/deckhouse/deckhouse/blob/main/ee/LICENSE
#
# This is a config for controller_metrics.py hook.

configVersion: v1
kubernetes:
  - name: deploy
    queue: /controller_metrics_deploy
    apiVersion: apps/v1
    kind: Deployment
    group: main
    executeHookOnEvent: []
    executeHookOnSynchronization: false
    keepFullObjectsInMemory: false
    jqFilter: |
      {
        "name": .metadata.name,
        "namespace": .metadata.namespace,
        "kind": .kind,
        "module": .metadata.labels.module,
      }
    labelSelector:
      matchLabels:
        heritage: "deckhouse"
  - name: ds
    queue: /controller_metrics_ds
    apiVersion: apps/v1
    kind: DaemonSet
    group: main
    executeHookOnEvent: []
    executeHookOnSynchronization: false
    keepFullObjectsInMemory: false
    jqFilter: |
      {
        "name": .metadata.name,
        "namespace": .metadata.namespace,
        "kind": .kind,
        "module": .metadata.labels.module,
      }
    labelSelector:
      matchLabels:
        heritage: "deckhouse"
  - name: sts
    queue: /controller_metrics_sts
    apiVersion: apps/v1
    kind: StatefulSet
    group: main
    executeHookOnEvent: []
    executeHookOnSynchronization: false
    keepFullObjectsInMemory: false
    jqFilter: |
      {
        "name": .metadata.name,
        "namespace": .metadata.namespace,
        "kind": .kind,
        "module": .metadata.labels.module,
      }
    labelSelector:
      matchLabels:
        heritage: "deckhouse"
  - name: pod
    queue: /controller_metrics_pod
    apiVersion: v1
    kind: Pod
    group: main
    executeHookOnEvent: []
    executeHookOnSynchronization: false
    keepFullObjectsInMemory: false
    namespace:
      nameSelector:
        matchNames: ["kube-system"]
    jqFilter: |
      {
        "name": .metadata.name,
        "namespace": .metadata.namespace,
        "kind": .kind,
        "module": .metadata.labels.module,
      }
    labelSelector:
      matchLabels:
        tier: "control-plane"
schedule:
  - name: "d8_controllers_schedule"
    # NOTE: If you are changing crontab frequency - please change a time duration
    # in prometheus query ("consumption_query" func) in controller_metrics.py file.
    crontab: "*/5 * * * *"
    group: "main"
